<?php
if ( !defined( "IN_OP" ) )
{
    exit( "You can't access this file directly..." );
}
if ( ( $curruser['acl'] < 255 || $curruser['acl'] == 255 && $curruser['prev_id'] != 0 ) && !SubAccountRight( $curruser, 1 ) )
{
    diemsg( "你不是管理者！" );
}
$ui = new UI();
$tpl = new Template2();
$rs = getdb( "select id,round,open,n1 from lotto where open>='".date( "Y-m-d" )."' order by open" );
if ( $rs->eof )
{
    $ui->showErrorPage( "<p>目前没有期数！</p>" );
    exit();
}
$lotto_id = $rs->f['id'];
$round = $rs->f['round'];
$open = $rs->f['open'];
$opnumber = $rs->f['n1'];
$rs->close();
$tpl->set( "lotto_id", $lotto_id );
$tpl->set( "round", d3( $round ) );
$tpl->set( "open", $open );
$conf = new config();
$stopbet = $conf->get( "waitbet" );
$startmode = "";
if ( date( "Y-m-d" ) < $open )
{
    $startmode = "disabled";
}
else if ( date( "Y-m-d" ) == $open )
{
    if ( $stopbet <= date( "Hi" ) && 0 < $opnumber )
    {
        $startmode = "disabled";
    }
    else if ( date( "Hi" ) <= $conf->get( "startbet" ) )
    {
        $startmode = "disabled";
    }
}
$t1 = strtotime( $open." ".$stopbet );
$tpl->Set( "timestap", $t1 - systime( ) );
$tpl->set( "phptime", systime( ) );
$norder = 1;
if ( isset( $_GET['norder'] ) && $_GET['norder'] != "" )
{
    $norder = $_GET['norder'];
}
$orderurl = preg_replace( "/norder=\\d?/", "", $_SERVER['REQUEST_URI'] );
$orders = "<select name=norder onchange=\"location.replace('".$orderurl."&norder='+this.value)\">";
$orders .= "<option value=1".( $norder == 1 ? " selected" : "" ).">正码一";
$orders .= "<option value=2".( $norder == 2 ? " selected" : "" ).">正码二";
$orders .= "<option value=3".( $norder == 3 ? " selected" : "" ).">正码三";
$orders .= "<option value=4".( $norder == 4 ? " selected" : "" ).">正码四";
$orders .= "<option value=5".( $norder == 5 ? " selected" : "" ).">正码五";
$orders .= "<option value=6".( $norder == 6 ? " selected" : "" ).">正码六";
$orders .= "</select>";
$tpl->set( "orders", $orders );
$tpl->set( "order_id", $norder );
$b51 = isset( $_COOKIE['b51'] ) ? $_COOKIE['b51'] : "";
$tpl->set( "b51", $b51 );
$b52 = isset( $_COOKIE['b52'] ) ? $_COOKIE['b52'] : "";
$tpl->set( "b52", $b52 );
$b53 = "";
$tpl->set( "b53", $b53 );
$tpl->set( "startnowdisable", $startmode );
$prot_user = array();
$j = 0;
$i = 0;
while ( $i < 10 )
{
    $name = $conf->get( "port_systemuser_".$i );
    if ( $name != "" )
    {
        $prot_user[$j] = $name;
        ++$j;
    }
    ++$i;
}
$userrame1 = "&nbsp;<select name=usr1 style='display:none'><option value='' selected> </option>";
$i = 0;
while ( $i < $j )
{
    $userrame1 .= "<option value='".$i."'>".$prot_user[$i]."</option>";
    ++$i;
}
$userrame1 .= "</select>";
$tpl->set( "select_usr1", $userrame1 );
include_once( "class_6h/class.menu.php" );
$fieldArr = array( "round" => $round, "open" => $open, "lotto_id" => $lotto_id, "split_id" => 1 );
$onlineMenu = new menu_6h( 2, $fieldArr );
$selectid = getvar( "select" ) == "" ? 0 : getvar( "select" );
$menuList = $onlineMenu->getMenu( $selectid );
$tpl->set( "menuList", $menuList );
unset( $onlineMenu );
$mnuArr = array( 1 => "正码一", 2 => "正码二", 3 => "正码三", 4 => "正码四", 5 => "正码五", 6 => "正码六" );
$smenu = "";
$i = 1;
while ( $i <= 6 )
{
    if ( 1 < $i )
    {
        $smenu .= "｜";
    }
    if ( $norder == $i )
    {
        $smenu .= "<font color=\"#800000\">".$mnuArr[$i]."</font>";
    }
    else
    {
        $smenu .= "<a href=\"op.php?op=admin&fp=unow23&lotto_id={$lotto_id}&norder={$i}&select={$selectid}\">".$mnuArr[$i]."</a>";
    }
    ++$i;
}
$tpl->set( "sub_menu", $smenu );
$tpl->load( "main", "unow23.htm" );
$tpl->set( "jslang", $g_conf['language'] );
$tpl->show( "main" );
$ui->footer();
?>